* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.game-area {
    display: flex;
    gap: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#gameCanvas {
    border: 2px solid #333;
    background-color: #000;
    width: 300px;
    height: 600px;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.score, .level {
    font-size: 1.2em;
    font-weight: bold;
}

.next-piece {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
}

button:hover {
    background-color: #45a049;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 300px;
}

.settings-group {
    margin: 15px 0;
}

.settings-group h3 {
    margin-bottom: 10px;
}

#nextCanvas {
    width: 100px;
    height: 100px;
    background-color: #000;
    border: 1px solid #333;
}

/* 修改游戏区域在移动端的样式 */
@media (max-width: 768px) {
    .container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        padding: 10px;
        max-width: 100%;
        position: relative;
    }

    /* 顶部控制面板 */
    .side-panel {
        position: sticky;
        top: 0;
        z-index: 1000;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: center;
        gap: 10px;
        padding: 10px;
        background: rgba(0, 0, 0, 0.8);
        border-radius: 10px;
        margin-bottom: 10px;
        width: 100%;
    }

    .side-panel > * {
        color: white;
    }

    .game-area {
        flex-direction: column;
        margin-bottom: 120px;
        padding: 0;
        background: none;
        box-shadow: none;
    }

    #gameCanvas {
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1/2;
        margin: 0 auto;
    }

    .controls {
        flex-direction: row;
        gap: 5px;
        order: -1; /* 将控制按钮移到最前面 */
    }

    .controls button {
        padding: 8px 12px;
        font-size: 0.9em;
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .controls button:active {
        background: rgba(255, 255, 255, 0.4);
    }

    .score, .level {
        background: rgba(255, 255, 255, 0.1);
        padding: 5px 10px;
        border-radius: 5px;
        min-width: 100px;
        text-align: center;
    }

    .next-piece {
        background: rgba(255, 255, 255, 0.1);
        padding: 5px;
        margin: 0;
        border-color: rgba(255, 255, 255, 0.3);
    }

    #nextCanvas {
        width: 80px;
        height: 80px;
        border-color: rgba(255, 255, 255, 0.3);
    }

    /* 调整模态框在移动端的样式 */
    .modal-content {
        width: 90%;
        max-width: 350px;
    }
}

/* 添加顶部安全区域适配 */
@supports (padding: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .side-panel {
            padding-top: calc(10px + env(safe-area-inset-top));
        }
    }
}

/* 添加安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .mobile-controls {
            padding-bottom: calc(10px + env(safe-area-inset-bottom));
        }
    }
} 